/*
 * @Author: 新时代的蛤蟆 1091676884@qq.com
 * @Date: 2024-11-07 19:09:55
 * @LastEditors: 新时代的蛤蟆 1091676884@qq.com
 * @LastEditTime: 2024-11-07 19:29:01
 * @FilePath: \jiazhuang-erp\src\main.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import '@/styles/element-variables.scss' // 自定义主题颜色

import 'quill/dist/quill.core.css' // import styles
import 'quill/dist/quill.snow.css' // for snow theme
import 'quill/dist/quill.bubble.css' // for bubble theme

import App from './App'
import store from './store'
import router from './router'
import searchSelect from "@/components/searchSelect";
import elSearchForm from "@/components/elSearchForm";
import ossUpload from "@/components/ossUpload";
import elInputRange from "@/components/elInputRange";

import '@/styles/index.scss' // global css
import '@/icons' // icon
import '@/permission' // permission control

// import '@/utils/watermark.js'; // 页面水印工具

Vue.use(ElementUI)
Vue.component('searchSelect', searchSelect)
Vue.component('el-search-form', elSearchForm)
Vue.component('oss-upload', ossUpload)
Vue.component('el-input-range', elInputRange)
Vue.directive('permission', {
  inserted: function (el, binding) {
    const action = binding.value.action
    const currentRight = router.currentRoute.meta.actionButtonList
    if (!currentRight.find(d => d.code === action)) {
      el.parentNode.removeChild(el)
    }
  }
})
Vue.directive('selectLoadMore', {
  bind(el, binding) {
    // 获取element-ui定义好的scroll盒子
    const SELECTWRAP_DOM = el.querySelector('.el-select-dropdown .el-select-dropdown__wrap')
    SELECTWRAP_DOM.addEventListener('scroll', function () {
      if (this.scrollHeight - this.scrollTop < this.clientHeight + 1) {
        binding.value()
      }
    })
  }
})

Vue.config.productionTip = false


new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
